﻿using System.Collections.Generic;

namespace Narwhunderful.Aphelia.Framework.Net
{

    internal class NarsockSendBuffer
    {

        LinkedList<object> _list = new LinkedList<object>();

        object _syncRoot = new object();
        public object SyncRoot
        {
            get
            {
                return _syncRoot;
            }
        }

        public int Count
        {
            get
            {
                return _list.Count;
            }
        }

        public void Clear()
        {
            _list.Clear();
        }

        public T Dequeue<T>()
        {
            if (_list.Count == 0) return default(T);
            T returnvalue = (T)_list.First.Value;
            _list.RemoveFirst();
            return returnvalue;
        }

        public void Enqueue(object obj)
        {
            _list.AddLast(obj);
        }
    }



}
